---
category: Level 1 — Basic
created: '2020-02-17'
keywords: getAttribute, get element attribute, removeAttribute, remove element attribute, setAttribute, set element attribute
title: 'Get, set and remove attributes'
---

## Get the attribute's value

```js
// Get the `title` attribute of a link element
const title = link.getAttribute('title');
```

## Set the attribute's value

```js
// Set the width and height of an image
image.setAttribute('width', '100px');
image.setAttribute('height', '120px');
```

## Remove the attribute

```js
// Remove the `title` attribute
ele.removeAttribute('title');
```

## See also

-   [Check if the native date input is supported](https://phuoc.ng/collection/html-dom/check-if-the-native-date-input-is-supported/)
-   [Count the number of characters of a textarea](https://phuoc.ng/collection/html-dom/count-the-number-of-characters-of-a-textarea/)
-   [Get set and remove data attributes](https://phuoc.ng/collection/html-dom/get-set-and-remove-data-attributes/)
-   [Placeholder for a contenteditable element](https://phuoc.ng/collection/html-dom/placeholder-for-a-contenteditable-element/)
-   [Print an image](https://phuoc.ng/collection/html-dom/print-an-image/)
-   [Toggle password visibility](https://phuoc.ng/collection/html-dom/toggle-password-visibility/)
